const db = require('../../../libs/db.config');

module.exports = async (data) => {
    // const searchSQL = `SELECT * FROM user WHERE userName = "${username}"`;
    const searchSQL = 'select commodity.images, commodity.title, orders.pay, orders.number, commodity.pID, userinfo.userName as sellerName, userinfo.photo from orders join commodity on commodity.userID = orders.seller join userinfo on userinfo.userID = orders.seller WHERE orders.buyer = ? and commodity.title LIKE ?';
    let params = '%' + data.title + '%'
    return await db.query(searchSQL, [data.userID, params]);
};
